package com.yanqu.road.dao.impl.cn.activity;

import com.yanqu.road.dao.impl.TempNoPoolDao;

import java.sql.CallableStatement;
import java.sql.ResultSet;
import java.util.HashMap;
import java.util.Map;

public class CnActivityGetPlatformIdDaoNotPoolImpl extends TempNoPoolDao {

    public CnActivityGetPlatformIdDaoNotPoolImpl(String dbParam) {
        super(dbParam);
    }

    public Map<Long, String> getPlatformUserIdByUserId(String idList) {
        ResultSet rs = null;
        CallableStatement call = null;
        Map<Long, String> map = new HashMap<>();
        String sql = "select userId,platformUserId from t_u_user where userId in (" + idList + ")";
        try {
            call = getConnection().prepareCall(sql);
            rs = call.executeQuery();
            while (rs.next()) {
                map.put(rs.getLong("userId"), rs.getString("platformUserId"));
            }
        } catch (Exception e) {
            throw new RuntimeException(e);
        } finally {
            closeConnection(call, rs);
        }
        return map;
    }
}
